#define _CRT_SECURE_NO_WARNINGS 1

class Solution {
public:
    bool isSumEqual(string firstWord, string secondWord, string targetWord) {
        reverse(firstWord.begin(), firstWord.end());
        reverse(secondWord.begin(), secondWord.end());
        reverse(targetWord.begin(), targetWord.end());

        int n = 0;
        int fir = 0;
        for (auto& e : firstWord)
        {
            fir += (e - 97) * pow(10, n++);
        }

        n = 0;
        int sec = 0;
        for (auto& e : secondWord)
        {
            sec += (e - 97) * pow(10, n++);
        }

        n = 0;
        int tar = 0;
        for (auto& e : targetWord)
        {
            tar += (e - 97) * pow(10, n++);
        }

        return fir + sec == tar;
    }
};